

class Person {
    public String name;
    public int age;
    public String gender;

    public Person() {
        this("张三", 18, "男");
        System.out.println("调用了无参构造方法");
    }

//    public Person(String name, int age) {
//        this.name = name;
//        this.age = age;
//        System.out.println("调用了有两个参构造方法");
//    }

    public Person(String name, int age, String gender) {
        this.name = name;
        this.age = age;
        this.gender=gender;
        System.out.println("调用了有三个参构造方法");
    }
}

public class Constructor {
    public static void main(String[] args) {
        Person person = new Person();
        System.out.println("姓名: " + person.name+",年龄: " + person.age+",性别: " + person.gender);
    }
}
